package com.service.socket.framework.configuration.tx;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;

import javax.sql.DataSource;

/** 
 *
 *  @desc
 */
@Configuration
public class TxConfig {

    /**
     * 其中 dataSource 框架会自动为我们注入,虽然ide报错但是可以运行
     * @param dataSource
     * @return
     */
    @Bean
    public PlatformTransactionManager txManager(DataSource dataSource) {
        return new DataSourceTransactionManager(dataSource);
    }

}
